home *** CD-ROM | disk | FTP | other *** search
- Attribute VB_Name = "ExplorerSupport"
- Option Explicit
-
- '<Constant>-----------------------------------------------------
- '---- misc
- Public Const nodPlaceHolder As String = "..."
-
- '---- Attachment constants
- '---- NodeTypes
- Public Const nodUndefined As Integer = -1
- Public Const nodDesktop As Integer = 1
- Public Const nodMyComputer As Integer = 2
- Public Const nodFTPServers As Integer = 3
- Public Const nodLocalDrive As Integer = 4
- Public Const nodLocalFolder As Integer = 5
- Public Const nodFTPServer As Integer = 6
- Public Const nodFTPFolder As Integer = 7
-
- '---- Small and Large Icons
- Public Const imgDesktop As Integer = 1
- Public Const imgPC As Integer = 2
- Public Const imgNetwork As Integer = 3
- Public Const imgFolderClosed As Integer = 4
- Public Const imgFolderOpen As Integer = 5
- Public Const imgDriveNotShared As Integer = 6
- Public Const imgDriveShared As Integer = 7
- Public Const imgCDRom As Integer = 8
- Public Const imgNetDrive As Integer = 9
- Public Const imgFTPDrive As Integer = 10
- Public Const imgLocalFile As Integer = 11
- Public Const imgFTPFile As Integer = 12
- Public Const imgFloppyDrive As Integer = 13
- Public Const imgFTPServers As Integer = 14
- Public Const imgPlaceHolder As Integer = 15
-
- '---- Toolbar
- Public Const imgUpOneLevel As Integer = 1
- Public Const imgConNetDrive As Integer = 2
- Public Const imgDisconNetDrive As Integer = 3
- Public Const imgConFTPServer As Integer = 4
- Public Const imgDisconFTPServer As Integer = 5
- Public Const imgLargeIcons As Integer = 6
- Public Const imgSmallIcons As Integer = 7
- Public Const imgList As Integer = 8
- Public Const imgDetails As Integer = 9
- '</Constant>----------------------------------------------------
-
- '---------------------------------------------------------------
- '<Purpose> checks to see is a key exists in a nodes collection
- '---------------------------------------------------------------
- Public Function IsKeyed(TheseNodes As Nodes, NodeKey As String) As Boolean
- Dim InstanceNode As Node
-
- For Each InstanceNode In TheseNodes
- If (InstanceNode.Key = NodeKey) Then
- IsKeyed = True
- GoTo Cleanup
- End If
- Next
-
- IsKeyed = False
-
- Cleanup:
- Set InstanceNode = Nothing
- End Function
-
- '---------------------------------------------------------------
- '<Purpose> sets a ListViews ColumnHeader state for persistence
- '---------------------------------------------------------------
- Public Sub SetColumnHeaderState(ThisWindow As Form, ThisAppName As String)
- Dim InstanceHeader As ColumnHeader
- Dim Header As Integer
- Dim Info As String
- Dim Section As String
-
- Header = 1
- For Each InstanceHeader In ThisWindow.List.ColumnHeaders
- Section = "ListView Header " & Header
- Info = CStr(InstanceHeader.Width)
- Call SaveSetting(App.ProductName, ThisAppName, Section, Info)
- Header = Header + 1
- Next
-
- End Sub
-
- '---------------------------------------------------------------
- '<Purpose> sets the splitter bar position for persistence
- '---------------------------------------------------------------
- Public Sub SetSplitterBarState(ThisWindow As Form, ThisAppName As String)
- Dim Info As String
-
- Info = CStr(ThisWindow.picSeparator.left)
- Call SaveSetting(App.ProductName, ThisAppName, "SplitterBarState", Info)
-
- End Sub
-
- '---------------------------------------------------------------
- '<Purpose> gets the splitter bar position for persistence
- '---------------------------------------------------------------
- Public Sub GetSplitterBarState(ThisWindow As Form, ThisAppName As String)
- Dim Info As String
-
- If (App.ProductName = "") Then
- MsgBox "You must enter a 'Product Name' using the EXE Options dialog box before you continue.", vbOKOnly + vbInformation
- Exit Sub
- End If
-
- 'get the splitter info ------------------
- Info = GetSetting(App.ProductName, ThisAppName, "SplitterBarState")
-
- 'move the splitter to its new position ---------------
- If (Info <> "") Then
- Call ThisWindow.SplitMe(CInt(Info), ThisWindow.Tree)
- End If
-
- End Sub
-
- '-----------------------------------------------------------------
- '<Purpose> puts all of the children of a node in the details list
- '-----------------------------------------------------------------
- Public Sub ListChildren(ThisExplorer As Form, ParentNode As Node)
- Dim i As Integer
- Dim NumberChildren As Integer
- Dim WorkingItem As ListItem
- Dim TheseItems As ListItems
- Dim WorkingNode As Node
-
- '---- cache ListItems collection
- Set TheseItems = ThisExplorer.List.ListItems
-
- NumberChildren = ParentNode.Children
- For i = 1 To NumberChildren
- If (i = 1) Then
- Set WorkingNode = ParentNode.Child
- Else
- Set WorkingNode = WorkingNode.Next
- End If
-
- Set WorkingItem = TheseItems.Add(, WorkingNode.Key, WorkingNode.Text, WorkingNode.Image, WorkingNode.Image)
-
- '--- add type, size, and modified bits
- 'WorkingItem.SubItems(1) = not used
- WorkingItem.SubItems(2) = Type2String(GetNodeType(ThisExplorer, WorkingNode))
- 'WorkingItem.SubItems(3) = not used
- Next
-
- Set TheseItems = Nothing
- Set WorkingItem = Nothing
- Set WorkingNode = Nothing
- End Sub
-
- '---------------------------------------------------------------
- '<Purpose> gets a ListViews ColumnHeader state for persistence
- '---------------------------------------------------------------
- Public Sub GetColumnHeaderState(ThisWindow As Form, ThisAppName As String)
- Dim InstanceHeader As ColumnHeader
- Dim Header As Integer
- Dim Info As String
- Dim Section As String
-
- If (App.ProductName = "") Then
- MsgBox "You must enter a 'Product Name' using the EXE Options dialog box before you continue.", vbOKOnly + vbInformation
- Exit Sub
- End If
-
- Header = 1
- For Each InstanceHeader In ThisWindow.List.ColumnHeaders
- Section = "ListView Header " & Header
- Info = GetSetting(App.ProductName, ThisAppName, Section)
- If (Info <> "") Then
- ThisWindow.List.ColumnHeaders(Header).Width = CInt(Info)
- End If
- Header = Header + 1
- Next
- End Sub
-
- '-------------------------------------------------------------------
- '<Purpose> gets the attachment for a given node
- '-------------------------------------------------------------------
- Public Function GetAttachment(ThisExplorer As Form, ThisNode As Node) As Attachment
-
- On Error GoTo NoAttachment
- Set GetAttachment = ThisExplorer.Attachments.Item(ThisNode.Key)
- On Error GoTo 0
- Exit Function
-
- NoAttachment:
- Set GetAttachment = Nothing
- On Error GoTo 0
-
- End Function
-
- '-------------------------------------------------------------------
- '<Purpose> gets the node type of a given node
- '-------------------------------------------------------------------
- Public Function GetNodeType(ThisExplorer As Form, ThisNode As Node) As Integer
- Dim ThisAttachment As Attachment
-
- On Error GoTo NoAttachment
- Set ThisAttachment = ThisExplorer.Attachments.Item(ThisNode.Key)
- GetNodeType = ThisAttachment.NodeType
-
- Cleanup:
- Set ThisAttachment = Nothing
- On Error GoTo 0
- Exit Function
-
- NoAttachment:
- GetNodeType = nodUndefined
- GoTo Cleanup
-
- End Function
-
- '-------------------------------------------------------------------
- '<Purpose> converts a node type to a string
- '-------------------------------------------------------------------
- Public Function Type2String(NodeType As Integer) As String
-
- Select Case NodeType
- Case nodUndefined: Type2String = "Unidentified"
- Case nodDesktop: Type2String = "Desktop"
- Case nodMyComputer: Type2String = "My Computer"
- Case nodFTPServers: Type2String = "FTP Servers"
- Case nodLocalDrive: Type2String = "Local Drive"
- Case nodLocalFolder: Type2String = "Local Folder"
- Case nodFTPServer: Type2String = "FTP Server"
- Case nodFTPFolder: Type2String = "FTP Folder"
- Case Else: Type2String = "Unknown"
- End Select
-
- End Function
-
-